package org.esti.model.utils;

import org.esti.service.AppraisalService;
import org.springframework.beans.factory.annotation.Autowired;

import java.beans.PropertyEditorSupport;

/**
 * @author ALoginov <a href="mailto:Artem.Loginov@exigenservices.com">Artem Loginov</a>
 * @since 10/22/11
 */
public class AppraisalPropertyEditor extends PropertyEditorSupport {

    @Autowired
    private final AppraisalService appraisalService;


    public AppraisalPropertyEditor(AppraisalService appraisalService) {
        this.appraisalService= appraisalService;
    }


    @Override
    public void setAsText(String idS) {
        Long id = Long.parseLong(idS);
        super.setValue(appraisalService.getAppraisalById(id));
    }
}
